/**
 * Author: Shen Yanqiu
 * Date: 2017-12-07
 * Time: 9:57
 *
 */
import React from 'react';
import { Row, Col } from 'antd';
import styles from './ShowImages.less';

class ShowImages extends React.Component {
  render () {
    const { images, files } = this.props;
    return (
      <div className={styles.showImages}>
        <h4>图片:</h4>
        <Row gutter={16}>
          {
            images !== undefined && images.length !== 0 ?
              images.map((item, index) => (
                <Col md={6} sm={8} xs={12} key={index}>
                  <img alt={item.alt} src={item.url} />
                </Col>
              )) : '暂无图片'
          }

        </Row>
        <h4>附件:</h4>
        <Row>
          <Col span={6}>
            {
              files !== undefined ?
                files.map((item, index) => (
                  <a href={item.url} target="_blank" key={index}>{item.filename}</a>
                ))
                : ''
            }
          </Col>
        </Row>
      </div>
    );
  }
}

export default ShowImages;
